package com.example.userservice.config;

import com.example.userservice.interceptor.JwtInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@RequiredArgsConstructor
public class WebConfig implements WebMvcConfigurer {
        private final JwtInterceptor jwtInterceptor;

        @Override
        public void addInterceptors(InterceptorRegistry registry) {
                registry.addInterceptor(jwtInterceptor)
                                .addPathPatterns(
                                                "/user/{userId}",
                                                "/users",
                                                "/user/reset-password")
                                .excludePathPatterns(
                                                "/user/login",
                                                "/user/register");
        }
}
